package com.lagou.page;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

@SpringBootApplication
@EnableDiscoveryClient//也是将当前项目标识为注册中心的客户端，向注册中心进行注册
@EnableFeignClients//开启Feign客户端功能,会自动启用熔断服务
public class PageApplication {

    public static void main(String[] args) {

        SpringApplication.run(PageApplication.class,args);

    }

    //向容器中注入一个restTemplate,封装了HttpClient
    @Bean
    @LoadBalanced
    public RestTemplate restTemplate(){

        return new RestTemplate();
    }


}
